#ifndef _RBTREE_H
#define _RBTREE_H 

#define COLOR_BLACK 'b'
#define COLOR_RED   'r'

typedef struct rbtree_node_s rbtree_node_t; 
typedef struct rbtree_node_s* rbtree_t;

struct rbtree_node_s
{
    int   data;
    char  color;
    struct rbtree_node_s *parent;
    struct  rbtree_node_s *lchild;
    struct rbtree_node_s *rchild;
};

int rbtree_insert(rbtree_t *root, int data);

int rbtree_delete(rbtree_t *root, int data);

void rbtree_postorder_print(rbtree_t root);

void rbtree_preorder_print(rbtree_t root);

void rbtree_inorder_print(rbtree_t root);

void rebalance(rbtree_t *base);

rbtree_node_t *rbtree_get_left_max(rbtree_node_t *c);

#endif 
